<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSettingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('settings', function (Blueprint $table) {
            $table->increments('id')->comment('配置表');
            $table->string('key', 32)->comment('程序使用的key值')->default('');
            $table->string('value', 255)->comment('配置项的值')->default('');
            $table->string('title', 32)->comment('配置项的标题描述')->default('');
            $table->unsignedInteger('setting_type_id')->comment('配置项的类型id')->default(0);
            $table->unsignedInteger('setting_group_id')->comment('配置项的分组id')->default(0);
            $table->integer('sort_number')->comment('排序标识')->default(0);
            $table->timestamps();
	        $table->index('sort_number');
	        $table->index('setting_type_id');
	        $table->index('setting_group_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('settings');
    }
}
